home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 November / PCWNOV08.iso / Software / Freeware / Adobe Media Player 1.1 / adobe_media_player.air / AMP.swf / scripts / mx / managers / WindowedSystemManager.as < prev    next >
Encoding:
Text File  |  2008-07-17  |  30.4 KB  |  1,002 lines

  1. package mx.managers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.DisplayObjectContainer;
  5.    import flash.display.Graphics;
  6.    import flash.display.InteractiveObject;
  7.    import flash.display.MovieClip;
  8.    import flash.display.Sprite;
  9.    import flash.display.StageAlign;
  10.    import flash.display.StageScaleMode;
  11.    import flash.events.Event;
  12.    import flash.events.MouseEvent;
  13.    import flash.geom.Point;
  14.    import flash.geom.Rectangle;
  15.    import flash.system.ApplicationDomain;
  16.    import flash.text.Font;
  17.    import flash.text.TextFormat;
  18.    import flash.ui.ContextMenu;
  19.    import mx.core.IChildList;
  20.    import mx.core.IFlexDisplayObject;
  21.    import mx.core.IFlexModule;
  22.    import mx.core.IUIComponent;
  23.    import mx.core.Singleton;
  24.    import mx.core.Window;
  25.    import mx.core.mx_internal;
  26.    import mx.events.FlexEvent;
  27.    import mx.styles.ISimpleStyleClient;
  28.    import mx.styles.IStyleClient;
  29.    
  30.    use namespace mx_internal;
  31.    
  32.    public class WindowedSystemManager extends MovieClip implements ISystemManager
  33.    {
  34.       private var _window:Window = null;
  35.       
  36.       mx_internal var nestLevel:int = 0;
  37.       
  38.       private var _topMostIndex:int = 0;
  39.       
  40.       private var originalSystemManager:SystemManager;
  41.       
  42.       private var forms:Array;
  43.       
  44.       private var topLevel:Boolean = true;
  45.       
  46.       private var mouseCatcher:Sprite;
  47.       
  48.       private var _height:Number;
  49.       
  50.       private var _cursorIndex:int = 0;
  51.       
  52.       mx_internal var _mouseX:*;
  53.       
  54.       private var _document:Object;
  55.       
  56.       private var _numModalWindows:int = 0;
  57.       
  58.       mx_internal var _mouseY:*;
  59.       
  60.       private var _screen:Rectangle;
  61.       
  62.       mx_internal var idleCounter:int = 0;
  63.       
  64.       private var _topLevelSystemManager:ISystemManager;
  65.       
  66.       private var _cursorChildren:WindowedSystemChildrenList;
  67.       
  68.       private var _toolTipIndex:int = 0;
  69.       
  70.       private var _rawChildren:WindowedSystemRawChildrenList;
  71.       
  72.       private var _noTopMostIndex:int = 0;
  73.       
  74.       private var myWindow:Window;
  75.       
  76.       private var form:IFocusManagerContainer;
  77.       
  78.       private var _width:Number;
  79.       
  80.       private var _toolTipChildren:WindowedSystemChildrenList;
  81.       
  82.       private var initialized:Boolean = false;
  83.       
  84.       private var _focusPane:Sprite;
  85.       
  86.       private var _fontList:Object = null;
  87.       
  88.       private var _popUpChildren:WindowedSystemChildrenList;
  89.       
  90.       mx_internal var topLevelWindow:IUIComponent;
  91.       
  92.       public function WindowedSystemManager(param1:IUIComponent)
  93.       {
  94.          forms = [];
  95.          super();
  96.          _topLevelSystemManager = this;
  97.          mx_internal::topLevelWindow = param1;
  98.          SystemManagerGlobals.topLevelSystemManagers.push(this);
  99.          addEventListener(Event.ADDED,docFrameHandler);
  100.       }
  101.       
  102.       mx_internal function rawChildren_removeChild(param1:DisplayObject) : DisplayObject
  103.       {
  104.          mx_internal::removingChild(param1);
  105.          super.removeChild(param1);
  106.          mx_internal::childRemoved(param1);
  107.          return param1;
  108.       }
  109.       
  110.       final mx_internal function get $numChildren() : int
  111.       {
  112.          return super.numChildren;
  113.       }
  114.       
  115.       public function get toolTipChildren() : IChildList
  116.       {
  117.          if(!topLevel)
  118.          {
  119.             return _topLevelSystemManager.toolTipChildren;
  120.          }
  121.          if(!_toolTipChildren)
  122.          {
  123.             _toolTipChildren = new WindowedSystemChildrenList(this,new QName(mx_internal,"topMostIndex"),new QName(mx_internal,"toolTipIndex"));
  124.          }
  125.          return _toolTipChildren;
  126.       }
  127.       
  128.       override public function removeChild(param1:DisplayObject) : DisplayObject
  129.       {
  130.          --mx_internal::noTopMostIndex;
  131.          return mx_internal::rawChildren_removeChild(param1);
  132.       }
  133.       
  134.       override public function addChild(param1:DisplayObject) : DisplayObject
  135.       {
  136.          ++mx_internal::noTopMostIndex;
  137.          return mx_internal::rawChildren_addChildAt(param1,mx_internal::noTopMostIndex - 1);
  138.       }
  139.       
  140.       public function activate(param1:IFocusManagerContainer) : void
  141.       {
  142.          var _loc2_:IFocusManagerContainer = null;
  143.          if(form)
  144.          {
  145.             if(form != param1 && forms.length > 1)
  146.             {
  147.                _loc2_ = form;
  148.                _loc2_.focusManager.deactivate();
  149.             }
  150.          }
  151.          form = param1;
  152.          if(param1.focusManager)
  153.          {
  154.             param1.focusManager.activate();
  155.          }
  156.       }
  157.       
  158.       mx_internal function rawChildren_getObjectsUnderPoint(param1:Point) : Array
  159.       {
  160.          return super.getObjectsUnderPoint(param1);
  161.       }
  162.       
  163.       mx_internal function rawChildren_getChildIndex(param1:DisplayObject) : int
  164.       {
  165.          return super.getChildIndex(param1);
  166.       }
  167.       
  168.       public function get document() : Object
  169.       {
  170.          return _document;
  171.       }
  172.       
  173.       mx_internal function get cursorIndex() : int
  174.       {
  175.          return _cursorIndex;
  176.       }
  177.       
  178.       override public function getChildIndex(param1:DisplayObject) : int
  179.       {
  180.          return super.getChildIndex(param1);
  181.       }
  182.       
  183.       override public function getObjectsUnderPoint(param1:Point) : Array
  184.       {
  185.          var _loc5_:DisplayObject = null;
  186.          var _loc6_:Array = null;
  187.          var _loc2_:Array = [];
  188.          var _loc3_:int = mx_internal::topMostIndex;
  189.          var _loc4_:int = 0;
  190.          while(_loc4_ < _loc3_)
  191.          {
  192.             _loc5_ = super.getChildAt(_loc4_);
  193.             if(_loc5_ is DisplayObjectContainer)
  194.             {
  195.                _loc6_ = DisplayObjectContainer(_loc5_).getObjectsUnderPoint(param1);
  196.                if(_loc6_)
  197.                {
  198.                   _loc2_ = _loc2_.concat(_loc6_);
  199.                }
  200.             }
  201.             _loc4_++;
  202.          }
  203.          return _loc2_;
  204.       }
  205.       
  206.       final mx_internal function $addChild(param1:DisplayObject) : DisplayObject
  207.       {
  208.          return super.addChild(param1);
  209.       }
  210.       
  211.       mx_internal function notifyStyleChangeInChildren(param1:String, param2:Boolean) : void
  212.       {
  213.          var _loc6_:IStyleClient = null;
  214.          var _loc3_:Boolean = false;
  215.          var _loc4_:int = int(rawChildren.numChildren);
  216.          var _loc5_:int = 0;
  217.          while(_loc5_ < _loc4_)
  218.          {
  219.             _loc6_ = rawChildren.getChildAt(_loc5_) as IStyleClient;
  220.             if(_loc6_)
  221.             {
  222.                _loc6_.styleChanged(param1);
  223.                _loc6_.notifyStyleChangeInChildren(param1,param2);
  224.             }
  225.             if(isTopLevelWindow(DisplayObject(_loc6_)))
  226.             {
  227.                _loc3_ = true;
  228.             }
  229.             _loc4_ = int(rawChildren.numChildren);
  230.             _loc5_++;
  231.          }
  232.          if(!_loc3_ && mx_internal::topLevelWindow is IStyleClient)
  233.          {
  234.             IStyleClient(mx_internal::topLevelWindow).styleChanged(param1);
  235.             IStyleClient(mx_internal::topLevelWindow).notifyStyleChangeInChildren(param1,param2);
  236.          }
  237.       }
  238.       
  239.       mx_internal function rawChildren_addChild(param1:DisplayObject) : DisplayObject
  240.       {
  241.          mx_internal::addingChild(param1);
  242.          super.addChild(param1);
  243.          mx_internal::childAdded(param1);
  244.          return param1;
  245.       }
  246.       
  247.       override public function get height() : Number
  248.       {
  249.          return _height;
  250.       }
  251.       
  252.       override public function setChildIndex(param1:DisplayObject, param2:int) : void
  253.       {
  254.          super.setChildIndex(param1,Math.min(mx_internal::noTopMostIndex + param2,numChildren - 1));
  255.       }
  256.       
  257.       mx_internal function regenerateStyleCache(param1:Boolean) : void
  258.       {
  259.          var _loc5_:IStyleClient = null;
  260.          var _loc2_:Boolean = false;
  261.          var _loc3_:int = int(rawChildren.numChildren);
  262.          var _loc4_:int = 0;
  263.          while(_loc4_ < _loc3_)
  264.          {
  265.             _loc5_ = rawChildren.getChildAt(_loc4_) as IStyleClient;
  266.             if(_loc5_)
  267.             {
  268.                _loc5_.regenerateStyleCache(param1);
  269.             }
  270.             if(isTopLevelWindow(DisplayObject(_loc5_)))
  271.             {
  272.                _loc2_ = true;
  273.             }
  274.             _loc3_ = int(rawChildren.numChildren);
  275.             _loc4_++;
  276.          }
  277.          if(!_loc2_ && mx_internal::topLevelWindow is IStyleClient)
  278.          {
  279.             IStyleClient(mx_internal::topLevelWindow).regenerateStyleCache(param1);
  280.          }
  281.       }
  282.       
  283.       mx_internal function addingChild(param1:DisplayObject) : void
  284.       {
  285.          var _loc4_:DisplayObjectContainer = null;
  286.          var _loc2_:int = 1;
  287.          if(!topLevel)
  288.          {
  289.             _loc4_ = parent.parent;
  290.             while(_loc4_)
  291.             {
  292.                if(_loc4_ is ILayoutManagerClient)
  293.                {
  294.                   _loc2_ = ILayoutManagerClient(_loc4_).nestLevel + 1;
  295.                   break;
  296.                }
  297.                _loc4_ = _loc4_.parent;
  298.             }
  299.          }
  300.          mx_internal::nestLevel = _loc2_;
  301.          if(param1 is IUIComponent)
  302.          {
  303.             IUIComponent(param1).systemManager = this;
  304.          }
  305.          var _loc3_:Class = Class(getDefinitionByName("mx.core.UIComponent"));
  306.          if(param1 is IUIComponent && !IUIComponent(param1).document)
  307.          {
  308.             IUIComponent(param1).document = document;
  309.          }
  310.          if(param1 is ILayoutManagerClient)
  311.          {
  312.             ILayoutManagerClient(param1).nestLevel = mx_internal::nestLevel + 1;
  313.          }
  314.          if(param1 is InteractiveObject)
  315.          {
  316.             if(doubleClickEnabled)
  317.             {
  318.                InteractiveObject(param1).doubleClickEnabled = true;
  319.             }
  320.          }
  321.          if(param1 is IUIComponent)
  322.          {
  323.             IUIComponent(param1).parentChanged(this);
  324.          }
  325.          if(param1 is IStyleClient)
  326.          {
  327.             IStyleClient(param1).regenerateStyleCache(true);
  328.          }
  329.          if(param1 is ISimpleStyleClient)
  330.          {
  331.             ISimpleStyleClient(param1).styleChanged(null);
  332.          }
  333.          if(param1 is IStyleClient)
  334.          {
  335.             IStyleClient(param1).notifyStyleChangeInChildren(null,true);
  336.          }
  337.          if(Boolean(_loc3_) && param1 is _loc3_)
  338.          {
  339.             _loc3_(param1).initThemeColor();
  340.          }
  341.          if(Boolean(_loc3_) && param1 is _loc3_)
  342.          {
  343.             _loc3_(param1).stylesInitialized();
  344.          }
  345.       }
  346.       
  347.       public function get embeddedFontList() : Object
  348.       {
  349.          var _loc1_:Object = null;
  350.          var _loc2_:String = null;
  351.          var _loc3_:Object = null;
  352.          if(_fontList == null)
  353.          {
  354.             _fontList = {};
  355.             _loc1_ = info()["fonts"];
  356.             for(_loc2_ in _loc1_)
  357.             {
  358.                _fontList[_loc2_] = _loc1_[_loc2_];
  359.             }
  360.             if(!topLevel && Boolean(_topLevelSystemManager))
  361.             {
  362.                _loc3_ = _topLevelSystemManager.embeddedFontList;
  363.                for(_loc2_ in _loc3_)
  364.                {
  365.                   _fontList[_loc2_] = _loc3_[_loc2_];
  366.                }
  367.             }
  368.          }
  369.          return _fontList;
  370.       }
  371.       
  372.       mx_internal function set cursorIndex(param1:int) : void
  373.       {
  374.          var _loc2_:int = param1 - _cursorIndex;
  375.          _cursorIndex = param1;
  376.       }
  377.       
  378.       mx_internal function get topMostIndex() : int
  379.       {
  380.          return _topMostIndex;
  381.       }
  382.       
  383.       public function set document(param1:Object) : void
  384.       {
  385.          _document = param1;
  386.       }
  387.       
  388.       public function isFontFaceEmbedded(param1:TextFormat) : Boolean
  389.       {
  390.          var _loc6_:Font = null;
  391.          var _loc7_:String = null;
  392.          var _loc2_:String = param1.font;
  393.          var _loc3_:Array = Font.enumerateFonts();
  394.          var _loc4_:int = 0;
  395.          while(_loc4_ < _loc3_.length)
  396.          {
  397.             _loc6_ = Font(_loc3_[_loc4_]);
  398.             if(_loc6_.fontName == _loc2_)
  399.             {
  400.                _loc7_ = "regular";
  401.                if(Boolean(param1.bold) && Boolean(param1.italic))
  402.                {
  403.                   _loc7_ = "boldItalic";
  404.                }
  405.                else if(param1.bold)
  406.                {
  407.                   _loc7_ = "bold";
  408.                }
  409.                else if(param1.italic)
  410.                {
  411.                   _loc7_ = "italic";
  412.                }
  413.                if(_loc6_.fontStyle == _loc7_)
  414.                {
  415.                   return true;
  416.                }
  417.             }
  418.             _loc4_++;
  419.          }
  420.          if(!_loc2_ || !embeddedFontList || !embeddedFontList[_loc2_])
  421.          {
  422.             return false;
  423.          }
  424.          var _loc5_:Object = embeddedFontList[_loc2_];
  425.          return !(Boolean(param1.bold) && !_loc5_.bold || Boolean(param1.italic) && !_loc5_.italic || !param1.bold && !param1.italic && !_loc5_.regular);
  426.       }
  427.       
  428.       mx_internal function rawChildren_setChildIndex(param1:DisplayObject, param2:int) : void
  429.       {
  430.          super.setChildIndex(param1,param2);
  431.       }
  432.       
  433.       private function resizeMouseCatcher() : void
  434.       {
  435.          var _loc1_:Graphics = null;
  436.          if(mouseCatcher)
  437.          {
  438.             _loc1_ = mouseCatcher.graphics;
  439.             _loc1_.clear();
  440.             _loc1_.beginFill(0,0);
  441.             _loc1_.drawRect(0,0,stage.stageWidth,stage.stageHeight);
  442.             _loc1_.endFill();
  443.          }
  444.       }
  445.       
  446.       mx_internal function set noTopMostIndex(param1:int) : void
  447.       {
  448.          var _loc2_:int = param1 - _noTopMostIndex;
  449.          _noTopMostIndex = param1;
  450.          mx_internal::topMostIndex += _loc2_;
  451.       }
  452.       
  453.       public function get rawChildren() : IChildList
  454.       {
  455.          if(!topLevel)
  456.          {
  457.             return _topLevelSystemManager.rawChildren;
  458.          }
  459.          if(!_rawChildren)
  460.          {
  461.             _rawChildren = new WindowedSystemRawChildrenList(this);
  462.          }
  463.          return _rawChildren;
  464.       }
  465.       
  466.       override public function getChildAt(param1:int) : DisplayObject
  467.       {
  468.          return super.getChildAt(mx_internal::noTopMostIndex + param1);
  469.       }
  470.       
  471.       mx_internal function rawChildren_getChildAt(param1:int) : DisplayObject
  472.       {
  473.          return super.getChildAt(param1);
  474.       }
  475.       
  476.       mx_internal function rawChildren_contains(param1:DisplayObject) : Boolean
  477.       {
  478.          return super.contains(param1);
  479.       }
  480.       
  481.       override public function removeChildAt(param1:int) : DisplayObject
  482.       {
  483.          --mx_internal::noTopMostIndex;
  484.          return mx_internal::rawChildren_removeChildAt(mx_internal::noTopMostIndex + param1);
  485.       }
  486.       
  487.       mx_internal function childAdded(param1:DisplayObject) : void
  488.       {
  489.          param1.dispatchEvent(new FlexEvent(FlexEvent.ADD));
  490.          if(param1 is IUIComponent)
  491.          {
  492.             IUIComponent(param1).initialize();
  493.          }
  494.       }
  495.       
  496.       final mx_internal function $removeChild(param1:DisplayObject) : DisplayObject
  497.       {
  498.          return super.removeChild(param1);
  499.       }
  500.       
  501.       private function Stage_resizeHandler(param1:Event = null) : void
  502.       {
  503.          var _loc2_:Number = stage.stageWidth;
  504.          var _loc3_:Number = stage.stageHeight;
  505.          var _loc4_:Number = 0;
  506.          var _loc5_:Number = 0;
  507.          if(!_screen)
  508.          {
  509.             _screen = new Rectangle();
  510.          }
  511.          _screen.x = _loc5_;
  512.          _screen.y = _loc4_;
  513.          _screen.width = _loc2_;
  514.          _screen.height = _loc3_;
  515.          _width = stage.stageWidth;
  516.          _height = stage.stageHeight;
  517.          if(param1)
  518.          {
  519.             resizeMouseCatcher();
  520.             dispatchEvent(param1);
  521.          }
  522.       }
  523.       
  524.       public function getDefinitionByName(param1:String) : Object
  525.       {
  526.          var _loc3_:Object = null;
  527.          var _loc2_:ApplicationDomain = ApplicationDomain.currentDomain;
  528.          if(_loc2_.hasDefinition(param1))
  529.          {
  530.             _loc3_ = _loc2_.getDefinition(param1);
  531.          }
  532.          return _loc3_;
  533.       }
  534.       
  535.       public function removeFocusManager(param1:IFocusManagerContainer) : void
  536.       {
  537.          var _loc2_:int = int(forms.length);
  538.          var _loc3_:int = 0;
  539.          while(_loc3_ < _loc2_)
  540.          {
  541.             if(forms[_loc3_] == param1)
  542.             {
  543.                if(form == param1)
  544.                {
  545.                   deactivate(param1);
  546.                }
  547.                forms.splice(_loc3_,1);
  548.                return;
  549.             }
  550.             _loc3_++;
  551.          }
  552.       }
  553.       
  554.       mx_internal function removingChild(param1:DisplayObject) : void
  555.       {
  556.          param1.dispatchEvent(new FlexEvent(FlexEvent.REMOVE));
  557.       }
  558.       
  559.       public function get focusPane() : Sprite
  560.       {
  561.          return _focusPane;
  562.       }
  563.       
  564.       mx_internal function rawChildren_removeChildAt(param1:int) : DisplayObject
  565.       {
  566.          var _loc2_:DisplayObject = super.getChildAt(param1);
  567.          mx_internal::removingChild(_loc2_);
  568.          super.removeChildAt(param1);
  569.          mx_internal::childRemoved(_loc2_);
  570.          return _loc2_;
  571.       }
  572.       
  573.       private function mouseDownHandler(param1:MouseEvent) : void
  574.       {
  575.          var _loc2_:int = 0;
  576.          var _loc3_:DisplayObject = null;
  577.          var _loc4_:Boolean = false;
  578.          var _loc5_:int = 0;
  579.          var _loc6_:int = 0;
  580.          var _loc7_:int = 0;
  581.          var _loc8_:int = 0;
  582.          var _loc9_:IChildList = null;
  583.          mx_internal::idleCounter = 0;
  584.          if(numModalWindows == 0)
  585.          {
  586.             if(forms.length > 1)
  587.             {
  588.                _loc2_ = int(forms.length);
  589.                _loc3_ = DisplayObject(param1.target);
  590.                _loc4_ = Boolean(document.rawChildren.contains(_loc3_));
  591.                while(_loc3_)
  592.                {
  593.                   _loc5_ = 0;
  594.                   while(_loc5_ < _loc2_)
  595.                   {
  596.                      if(forms[_loc5_] == _loc3_)
  597.                      {
  598.                         _loc6_ = 0;
  599.                         if(_loc3_ != form && _loc3_ is IFocusManagerContainer)
  600.                         {
  601.                            activate(IFocusManagerContainer(_loc3_));
  602.                         }
  603.                         if(popUpChildren.contains(_loc3_))
  604.                         {
  605.                            _loc9_ = popUpChildren;
  606.                         }
  607.                         else
  608.                         {
  609.                            _loc9_ = this;
  610.                         }
  611.                         _loc8_ = _loc7_ = int(_loc9_.getChildIndex(_loc3_));
  612.                         _loc2_ = int(forms.length);
  613.                         _loc6_ = 0;
  614.                         while(_loc6_ < _loc2_)
  615.                         {
  616.                            if(_loc9_.contains(forms[_loc6_]))
  617.                            {
  618.                               if(_loc9_.getChildIndex(forms[_loc6_]) > _loc7_)
  619.                               {
  620.                                  _loc8_ = int(_loc9_.getChildIndex(forms[_loc6_]));
  621.                               }
  622.                            }
  623.                            _loc6_++;
  624.                         }
  625.                         if(_loc8_ > _loc7_ && !_loc4_)
  626.                         {
  627.                            _loc9_.setChildIndex(_loc3_,_loc8_);
  628.                         }
  629.                         return;
  630.                      }
  631.                      _loc5_++;
  632.                   }
  633.                   _loc3_ = _loc3_.parent;
  634.                }
  635.             }
  636.          }
  637.       }
  638.       
  639.       override public function get mouseX() : Number
  640.       {
  641.          if(mx_internal::_mouseX === undefined)
  642.          {
  643.             return super.mouseX;
  644.          }
  645.          return mx_internal::_mouseX;
  646.       }
  647.       
  648.       public function get screen() : Rectangle
  649.       {
  650.          if(!_screen)
  651.          {
  652.             _screen = new Rectangle();
  653.          }
  654.          _screen.x = 0;
  655.          _screen.y = 0;
  656.          _screen.width = stage.stageWidth;
  657.          _screen.height = stage.stageHeight;
  658.          return _screen;
  659.       }
  660.       
  661.       mx_internal function set toolTipIndex(param1:int) : void
  662.       {
  663.          var _loc2_:int = param1 - _toolTipIndex;
  664.          _toolTipIndex = param1;
  665.          mx_internal::cursorIndex += _loc2_;
  666.       }
  667.       
  668.       override public function get mouseY() : Number
  669.       {
  670.          if(mx_internal::_mouseY === undefined)
  671.          {
  672.             return super.mouseY;
  673.          }
  674.          return mx_internal::_mouseY;
  675.       }
  676.       
  677.       public function set numModalWindows(param1:int) : void
  678.       {
  679.          _numModalWindows = param1;
  680.       }
  681.       
  682.       public function isTopLevel() : Boolean
  683.       {
  684.          return topLevel;
  685.       }
  686.       
  687.       mx_internal function set topMostIndex(param1:int) : void
  688.       {
  689.          var _loc2_:int = param1 - _topMostIndex;
  690.          _topMostIndex = param1;
  691.          mx_internal::toolTipIndex += _loc2_;
  692.       }
  693.       
  694.       public function get cursorChildren() : IChildList
  695.       {
  696.          if(!topLevel)
  697.          {
  698.             return _topLevelSystemManager.cursorChildren;
  699.          }
  700.          if(!_cursorChildren)
  701.          {
  702.             _cursorChildren = new WindowedSystemChildrenList(this,new QName(mx_internal,"toolTipIndex"),new QName(mx_internal,"cursorIndex"));
  703.          }
  704.          return _cursorChildren;
  705.       }
  706.       
  707.       private function initContextMenu() : void
  708.       {
  709.          var _loc1_:ContextMenu = new ContextMenu();
  710.          _loc1_.hideBuiltInItems();
  711.          _loc1_.builtInItems.print = true;
  712.          contextMenu = _loc1_;
  713.       }
  714.       
  715.       public function deactivate(param1:IFocusManagerContainer) : void
  716.       {
  717.          var _loc2_:IFocusManagerContainer = null;
  718.          var _loc3_:int = 0;
  719.          var _loc4_:int = 0;
  720.          var _loc5_:IFocusManagerContainer = null;
  721.          if(form)
  722.          {
  723.             if(form == param1 && forms.length > 1)
  724.             {
  725.                form.focusManager.deactivate();
  726.                _loc3_ = int(forms.length);
  727.                _loc4_ = 0;
  728.                while(_loc4_ < _loc3_)
  729.                {
  730.                   _loc5_ = forms[_loc4_];
  731.                   if(_loc5_ == param1)
  732.                   {
  733.                      _loc4_ += 1;
  734.                      while(_loc4_ < _loc3_)
  735.                      {
  736.                         _loc5_ = forms[_loc4_];
  737.                         if(Sprite(_loc5_).visible == true && Boolean(IUIComponent(_loc5_).enabled))
  738.                         {
  739.                            _loc2_ = _loc5_;
  740.                         }
  741.                         _loc4_++;
  742.                      }
  743.                      form = _loc2_;
  744.                      break;
  745.                   }
  746.                   if(Sprite(_loc5_).visible && Boolean(IUIComponent(_loc5_).enabled))
  747.                   {
  748.                      _loc2_ = _loc5_;
  749.                   }
  750.                   _loc4_++;
  751.                }
  752.                if(form)
  753.                {
  754.                   form.focusManager.activate();
  755.                }
  756.             }
  757.          }
  758.       }
  759.       
  760.       protected function docFrameHandler(param1:Event = null) : void
  761.       {
  762.          var _loc3_:int = 0;
  763.          var _loc4_:int = 0;
  764.          var _loc5_:Class = null;
  765.          removeEventListener(Event.ADDED,docFrameHandler);
  766.          if(stage)
  767.          {
  768.             stage.scaleMode = StageScaleMode.NO_SCALE;
  769.             stage.align = StageAlign.TOP_LEFT;
  770.          }
  771.          var _loc2_:Array = info()["mixins"];
  772.          if(Boolean(_loc2_) && _loc2_.length > 0)
  773.          {
  774.             _loc3_ = int(_loc2_.length);
  775.             _loc4_ = 0;
  776.             while(_loc4_ < _loc3_)
  777.             {
  778.                _loc5_ = Class(getDefinitionByName(_loc2_[_loc4_]));
  779.                _loc5_["init"](this);
  780.                _loc4_++;
  781.             }
  782.          }
  783.          initializeTopLevelWindow(null);
  784.          if(Singleton.getClass("mx.managers::IDragManager").getInstance() is NativeDragManagerImpl)
  785.          {
  786.             NativeDragManagerImpl(Singleton.getClass("mx.managers::IDragManager").getInstance()).mx_internal::registerSystemManager(this);
  787.          }
  788.       }
  789.       
  790.       public function get topLevelSystemManager() : ISystemManager
  791.       {
  792.          if(topLevel)
  793.          {
  794.             return this;
  795.          }
  796.          return _topLevelSystemManager;
  797.       }
  798.       
  799.       mx_internal function rawChildren_getChildByName(param1:String) : DisplayObject
  800.       {
  801.          return super.getChildByName(param1);
  802.       }
  803.       
  804.       mx_internal function get noTopMostIndex() : int
  805.       {
  806.          return _noTopMostIndex;
  807.       }
  808.       
  809.       mx_internal function childRemoved(param1:DisplayObject) : void
  810.       {
  811.          if(param1 is IUIComponent)
  812.          {
  813.             IUIComponent(param1).parentChanged(null);
  814.          }
  815.       }
  816.       
  817.       override public function addChildAt(param1:DisplayObject, param2:int) : DisplayObject
  818.       {
  819.          ++mx_internal::noTopMostIndex;
  820.          return mx_internal::rawChildren_addChildAt(param1,param2);
  821.       }
  822.       
  823.       final mx_internal function $removeChildAt(param1:int) : DisplayObject
  824.       {
  825.          return super.removeChildAt(param1);
  826.       }
  827.       
  828.       override public function getChildByName(param1:String) : DisplayObject
  829.       {
  830.          return super.getChildByName(param1);
  831.       }
  832.       
  833.       mx_internal function cleanup(param1:Event) : void
  834.       {
  835.          if(NativeDragManagerImpl(Singleton.getClass("mx.managers::IDragManager").getInstance()) is NativeDragManagerImpl)
  836.          {
  837.             NativeDragManagerImpl(Singleton.getClass("mx.managers::IDragManager").getInstance()).mx_internal::unregisterSystemManager(this);
  838.          }
  839.          SystemManagerGlobals.topLevelSystemManagers.splice(SystemManagerGlobals.topLevelSystemManagers.indexOf(this),1);
  840.          myWindow.removeEventListener("close",mx_internal::cleanup);
  841.          myWindow = null;
  842.       }
  843.       
  844.       public function info() : Object
  845.       {
  846.          return {};
  847.       }
  848.       
  849.       mx_internal function get toolTipIndex() : int
  850.       {
  851.          return _toolTipIndex;
  852.       }
  853.       
  854.       final mx_internal function $addChildAt(param1:DisplayObject, param2:int) : DisplayObject
  855.       {
  856.          return super.addChildAt(param1,param2);
  857.       }
  858.       
  859.       mx_internal function rawChildren_addChildAt(param1:DisplayObject, param2:int) : DisplayObject
  860.       {
  861.          mx_internal::addingChild(param1);
  862.          super.addChildAt(param1,param2);
  863.          mx_internal::childAdded(param1);
  864.          return param1;
  865.       }
  866.       
  867.       protected function initializeTopLevelWindow(param1:Event) : void
  868.       {
  869.          var _loc2_:IUIComponent = null;
  870.          var _loc3_:DisplayObjectContainer = null;
  871.          initialized = true;
  872.          if(!parent)
  873.          {
  874.             return;
  875.          }
  876.          initContextMenu();
  877.          if(!topLevel)
  878.          {
  879.             _loc3_ = parent.parent;
  880.             if(!_loc3_)
  881.             {
  882.                return;
  883.             }
  884.             while(_loc3_)
  885.             {
  886.                if(_loc3_ is IUIComponent)
  887.                {
  888.                   _topLevelSystemManager = IUIComponent(_loc3_).systemManager;
  889.                   break;
  890.                }
  891.                _loc3_ = _loc3_.parent;
  892.             }
  893.          }
  894.          addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler,true);
  895.          stage.addEventListener(Event.RESIZE,Stage_resizeHandler,false,0,true);
  896.          document = _loc2_ = mx_internal::topLevelWindow;
  897.          if(document)
  898.          {
  899.             if(topLevel && Boolean(stage))
  900.             {
  901.                _width = stage.stageWidth;
  902.                _height = stage.stageHeight;
  903.                IFlexDisplayObject(_loc2_).setActualSize(stage.stageWidth,stage.stageHeight);
  904.             }
  905.             else
  906.             {
  907.                IFlexDisplayObject(_loc2_).setActualSize(loaderInfo.width,loaderInfo.height);
  908.             }
  909.             mx_internal::addingChild(DisplayObject(_loc2_));
  910.             mx_internal::childAdded(DisplayObject(_loc2_));
  911.          }
  912.          else
  913.          {
  914.             document = this;
  915.          }
  916.       }
  917.       
  918.       public function set focusPane(param1:Sprite) : void
  919.       {
  920.          if(param1)
  921.          {
  922.             addChild(param1);
  923.             param1.x = 0;
  924.             param1.y = 0;
  925.             param1.scrollRect = null;
  926.             _focusPane = param1;
  927.          }
  928.          else
  929.          {
  930.             removeChild(_focusPane);
  931.             _focusPane = null;
  932.          }
  933.       }
  934.       
  935.       override public function get width() : Number
  936.       {
  937.          return _width;
  938.       }
  939.       
  940.       public function isTopLevelWindow(param1:DisplayObject) : Boolean
  941.       {
  942.          return param1 is IUIComponent && IUIComponent(param1) == mx_internal::topLevelWindow;
  943.       }
  944.       
  945.       public function get numModalWindows() : int
  946.       {
  947.          return _numModalWindows;
  948.       }
  949.       
  950.       mx_internal function set window(param1:Window) : void
  951.       {
  952.          _window = param1;
  953.       }
  954.       
  955.       public function get popUpChildren() : IChildList
  956.       {
  957.          if(!topLevel)
  958.          {
  959.             return _topLevelSystemManager.popUpChildren;
  960.          }
  961.          if(!_popUpChildren)
  962.          {
  963.             _popUpChildren = new WindowedSystemChildrenList(this,new QName(mx_internal,"noTopMostIndex"),new QName(mx_internal,"topMostIndex"));
  964.          }
  965.          return _popUpChildren;
  966.       }
  967.       
  968.       mx_internal function get window() : Window
  969.       {
  970.          return _window;
  971.       }
  972.       
  973.       mx_internal function addWindow(param1:Window) : void
  974.       {
  975.          myWindow = param1;
  976.          myWindow.nativeWindow.addEventListener("close",mx_internal::cleanup);
  977.       }
  978.       
  979.       public function addFocusManager(param1:IFocusManagerContainer) : void
  980.       {
  981.          forms.push(param1);
  982.       }
  983.       
  984.       public function create(... rest) : Object
  985.       {
  986.          var _loc2_:String = String(rest[0]);
  987.          var _loc3_:Class = Class(getDefinitionByName(_loc2_));
  988.          if(!_loc3_)
  989.          {
  990.             throw new Error("Class \'" + _loc2_ + "\' not found.");
  991.          }
  992.          var _loc4_:Object = new _loc3_();
  993.          if(_loc4_ is IFlexModule)
  994.          {
  995.             IFlexModule(_loc4_).moduleFactory = this;
  996.          }
  997.          return _loc4_;
  998.       }
  999.    }
  1000. }
  1001.  
  1002.